package com.pagepub.expo.manager;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.flex.remoting.RemotingInclude;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.pagepub.expo.dao.CorpCatalogDao;
import com.pagepub.expo.dao.RoleFunctionDao;
import com.pagepub.expo.entity.CorpCatalog;
import com.pagepub.expo.entity.IdName;
import com.pagepub.expo.entity.RoleFunction;

@Service
@Transactional
@RemotingDestination(channels = { "my-amf", "my-secure-amf" })
public class RoleFunctionMng {

	@Autowired
	private RoleFunctionDao roleFunctionDao;

	@RemotingInclude
	@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
	public List<RoleFunction> findAllByFun(Long funId) {
		return roleFunctionDao.findAllByFun(funId);
	}

	@RemotingInclude
	@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
	public List<RoleFunction> findAllByRole(Long roleId) {
		return roleFunctionDao.findAllByRole(roleId);
	}

	@RemotingInclude
	@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
	public void insert(RoleFunction bean) {
		roleFunctionDao.insert(bean);
	}

	@RemotingInclude
	@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
	public void deleteByFun(Long id) {
		roleFunctionDao.deleteByFun(id);
	}
	
	@RemotingInclude
	@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
	public void deleteByRole(Long id) {
		roleFunctionDao.deleteByRole(id);
	}
}